package com.zhongketech.sunflower.utils;

import java.io.DataOutputStream;

import com.zhongketech.sunflower.transport.LogUtil;


public class Cmd {

	private static final String TAG = "CheckRoot";


	public static void exeCmd(String cmdString) {
		Process process = null;
		DataOutputStream os = null;
		try {
			process = Runtime.getRuntime().exec("su"); //切换到root帐号
			os = new DataOutputStream(process.getOutputStream());
			LogUtil.i(TAG, "cmdString: "+cmdString);
			os.writeBytes(cmdString + "\n");
			os.writeBytes("exit\n");
			os.flush();
			process.waitFor();
		} catch (Exception e) {

		} finally {
			try {
				if (os != null) {
					os.close();
				}
				process.destroy();
			} catch (Exception e) {
			}
		}

	}


}